from django.db import models

# Create your models here.


# 数据库缓存数据表
class CacheModel(models.Model):
    cache_key = models.TextField()
    value = models.TextField()
    expires = models.DateTimeField()


# 邮件接收地址
class EmailModel(models.Model):
    address = models.EmailField(max_length=128, blank=True, unique=True)


class BasicModel(models.Model):
    exchange = models.TextField()
    strategy = models.TextField()


class UsersKeyModel(BasicModel):
    api_key = models.TextField()
    secret_key = models.TextField()
    passphrase = models.TextField()     # 密钥密码（目前只有okx交易所使用）


# 记录程序进程号
class ProcessNumber(BasicModel):
    process = models.JSONField(null=True)
    status = models.CharField(max_length=18, default='-1', choices=(
        ('-1', '立即停止'),
        ('1', '运行中'),
        ('0', '平仓停止'),
    ))
    pan_opening = models.CharField(max_length=18, default='1', choices=(
        ('0', '实盘'),
        ('1', '模拟盘'),
    ))
    timestamp = models.TextField()
